﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApp1.Model;


namespace WpfApp1
{
    /// <summary>  
    /// Interaction logic for MainWindow.xaml  
    /// </summary>  
    public partial class MainWindow : Window
    {
        // 添加 CurrentPerson 字段  
        public Person CurrentPerson { get; set; }

        public MainWindow()
        {
            InitializeComponent();

            // 创建 Person 类的实例并初始化 Name 属性  
            CurrentPerson = new Person { Name = "" };

            // 将 MainWindow 的 DataContext 设置为 CurrentPerson 实例  
            this.DataContext = CurrentPerson;
        }
        private void myButton_Click(object sender, RoutedEventArgs e)
        {
            // 获取 nameTextBox 中的文本
            string name = nameTextBox.Text;

            // 显示包含输入名字的问候语
            MessageBox.Show($"你好，{name}！");
        }
    }
}